home *** CD-ROM | disk | FTP | other *** search
- Q31779 Typedef Signed Char Treated as Unsigned Char with /J
- C Compiler
- 5.00 5.10
- MS-DOS
-
- Summary:
- When an item is typedef'ed as signed char, the compiler incorrectly
- treats the variable as an unsigned character when compiled with the /J
- switch. The /J switch tells the compiler to interpret all characters
- that are not explicitly declared as signed as unsigned type.
- Microsoft has confirmed this to be a problem in Version 5.10 of the
- C compiler.
- Microsoft is researching this problem and will post new information
- as it becomes available.
-
- More Information:
- The expected output for the following program is:
-
- typedef_signed_char = -1
- signed_char = -1
- unsigned_char = 255
- default_char = 255
-
- However, when compiled with /J, the output is:
-
- typedef_signed_char = 255
- signed_char = -1
- unsigned_char = 255
- default_char = 255
-
- The following code example reproduces the problem:
-
- #include <stdio.h>
- /*
- compile cl -J fooj.c
- */
-
- typedef signed char FOO;
-
- void main(void);
-
- void main()
- {
- FOO typedef_signed_char = 255;
- signed char signed_char = 255;
- unsigned char unsigned_char = 255;
- char default_char = 255;
-
- printf( "typedef_signed_char = %ld\n", (long)typedef_signed_char );
- printf( " signed_char = %ld\n", (long)signed_char );
- printf( " unsigned_char = %ld\n", (long)unsigned_char );
- printf( " default_char = %ld\n", (long)default_char );
-
-
- } /* main */
-
-
- Keywords: buglist5.10
- Updated 88/07/21 03:19
-